package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it.networkassets;

import com.glsc.ngateway.common.base.domain.mysql.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 接口状态
 * @author xuchang
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@Where(clause = "deleted = 0")
@SQLDelete(sql = "update t_gw_it_net_assets_interface_status set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@SQLDeleteAll(sql = "update t_gw_it_net_assets_interface_status set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@Table(name = "t_gw_it_net_assets_interface_status", indexes = {@Index(name = "UK_HOST_IF_INDEX", columnList = "host, if_index, deleted", unique = true)})
public class InterfaceStatus extends BaseEntity implements Serializable  {

    private static final long serialVersionUID = -1222768276862243877L;

    @Column(name = "host", columnDefinition = "varchar(128) not null comment '主机'")
    private String host;

    @Column(name = "if_index", columnDefinition = "varchar(128) comment '接口索引'")
    private String ifIndex;

    @Column(name = "if_name", columnDefinition = "varchar(128) comment '接口名称'")
    private String ifName;

    @Column(name = "if_type", columnDefinition = "varchar(128) comment '接口类型'")
    private String ifType;

    @Column(name = "if_high_speed", columnDefinition = "varchar(128) comment '接口速率'")
    private String ifHighSpeed;

    @Column(name = "if_oper_status", columnDefinition = "varchar(128) comment '接口状态'")
    private String ifOperStatus;

    @Column(name = "if_err_dis", columnDefinition = "varchar(128) comment '错误代码'")
    private String ifErrDis;

}
